import requests

url = 'http://scxk.nmpa.gov.cn:81/xk/itownet/portalAction.do?method=getXkzsList'
file = open('id.txt', mode='w')
for i in range(5):
    data = {
        'on': 'true',
        'page': i,
        'pageSize': '15',
        'conditionType': '1',
    }
    res = requests.post(url, data=data).json()
    for i in range(15):
        file.writelines("企业名称:{},许可证编号:{},"
                        "发证机关:{},有效期至:{},"
                        "发证日期:{}\n"
                        .format(res["list"][i]['EPS_NAME'],
                                res["list"][i]['PRODUCT_SN'],
                                res["list"][i]['QF_MANAGER_NAME'],
                                res["list"][i]['XK_DATE'],
                                res["list"][i]['XC_DATE']))
file.close()
